package com.dmatek.uwb.xml.dom.bean;

import java.util.ArrayList;
import java.util.List;

import com.dmatek.uwb.packet.bean.BindNode;
import com.dmatek.uwb.xml.dom.annotations.AttributeName;
/***
 * 单点定位时的分割线
 * @author zhangfu
 * @data 2019年6月17日 下午1:48:02
 * @Description
 */
public class Divider implements DomElement{
	public final static String DOM_NAME = "Divider";
	@AttributeName("id")
	private String id;
	@AttributeName("start")
	private Point start;
	@AttributeName("end")
	private Point end;
	@AttributeName("BindNodes")
	private List<BindNode> bindNodes;
	public Divider() {
		super();
		bindNodes = new ArrayList<BindNode>();
	}
	public Divider(Point start, Point end) {
		super();
		this.start = start;
		this.end = end;
	}
	public Divider(String id, Point start, Point end, List<BindNode> bindNodes) {
		super();
		this.id = id;
		this.start = start;
		this.end = end;
		this.bindNodes = bindNodes;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Point getStart() {
		return start;
	}
	public void setStart(Point start) {
		this.start = start;
	}
	public Point getEnd() {
		return end;
	}
	public void setEnd(Point end) {
		this.end = end;
	}
	public List<BindNode> getBindNodes() {
		return bindNodes;
	}
	public void setBindNodes(List<BindNode> bindNodes) {
		this.bindNodes = bindNodes;
	}
	/***
	 * 获取优先级
	 * @param id
	 * @param bindId
	 * @return
	 */
	public String obtainPriority(String id, String bindId) {
		for (BindNode bindNode : bindNodes) {
			if (bindNode.getId().equals(id) 
			 && bindNode.getBindId().equals(bindId)) {
                return id;
            } else if (bindNode.getId().equals(bindId) 
             && bindNode.getBindId().equals(id))
            {
                return bindId;
            }
		}
		return null;
	}
	@Override
	public String getDomName() {
		return DOM_NAME;
	}
}
